﻿using System;
using XiaWorld;

namespace WritingBooks
{
    public class BehaviourWrite : BehaviourBase
    {
        public BehaviourWrite(g_emBehaviourKind kind, g_emBehaviourWorkKind workkind, int MPriority) : base(kind, workkind, MPriority)
        {
        }

        public override JobBase Check(Npc npc, int seachr = 10000, bool tryfind = false)
        {
            if (npc.HealthState != g_emNpcHealthState.Normal)
            {
                return null;
            }
            Command command = CommandMgr.Instance.FindCommandAtThing("Write", npc, npc);
            if (command != null)
            {
                return JobMgr.Instance.CreateJob("JobWrite", command, new object[0]);
            }
            command = CommandMgr.Instance.FindCommandAtThing("PaintCharm", npc, npc);
            if (command != null)
            {
                return JobMgr.Instance.CreateJob("JobPaintCharm", command, new object[0]);
            }
            return null;
        }
    }
}
